package com.xiaoyun.service.impl;

import com.xiaoyun.pojo.Carousel;
import com.xiaoyun.repository.CarouselRepository;
import com.xiaoyun.service.CarouseService;
import lombok.RequiredArgsConstructor;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@RequiredArgsConstructor
public class CarouseServiceImpl implements CarouseService {

    private final CarouselRepository carouselRepository;

    @Override
    @Cacheable(value = "carouseService", key = "#isShow")
    public List<Carousel> queryAll(Integer isShow) {
        List<Carousel> result = carouselRepository.findByIsShowOrderBySortDesc(isShow);
        return result;
    }
}
